package com.itheima.lambda;

public class Demo {
    public static void main(String[] args) {

        Cal c = new Cal();
        int calc2 = c.calc(20, 10);
        System.out.println("calc2 = " + calc2);

        Calculator calculator = new Calculator() {
            @Override
            public int calc(int a, int b) {
                return a+b;
            }
        };
        int calc = calculator.calc(10, 20);
        System.out.println("calc = " + calc);

        Calculator calculator1 = (int a,int b) -> {return a*b;};
        int calc1 = calculator1.calc(4, 5);
        System.out.println("calc1 = " + calc1);
    }
}
interface  Calculator {
    int calc(int a,int b);
}
class Cal implements Calculator{

    @Override
    public int calc(int a, int b) {
        return a-b;
    }
}